package com.taoyusen.jpf.facade;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.taoyusen.common.BeanFactory;
import com.taoyusen.jpf.JPFBeanNames;
import com.taoyusen.jpf.server.IUserInfoServer;
import com.taoyusen.jpf.server.dto.UserInfoDto;


public class UserInfoFacade 
{

	private IUserInfoServer userInfServer = (IUserInfoServer)BeanFactory.getBeanByName(JPFBeanNames.USERINFOSERVICE);
	
	public List<UserInfoDto> getAllUserInfoDto()
	{
		List result = new ArrayList();
		try
		{
			 result =  userInfServer.getAllUserInfoDto();
		}
		catch (Exception e) 
		{
			e.printStackTrace();
		}
		return result;
	}
	
	public List<UserInfoDto> getUserInfoByMap(Map<String, Object> userMap)
	{
		List result = new ArrayList();
		try
		{
			result = this.userInfServer.getUserInfoByMap(userMap);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		return result;
	}

	
	public List<UserInfoDto> getUserInfoByuserName(String userName)
	{
		List result = new ArrayList();
		try
		{
			result = this.userInfServer.getUserInfoByUserName(userName);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		return result;
	}
	
	public String deleteUserByuserId(String userId)
	{
		String message="";
		try
		{
			if(this.userInfServer.deleteUser(userId))
			{
				message ="删除成功";
			}
			else
			{
				message ="删除失败";
			}
		}
		catch (Exception e) 
		{
			e.printStackTrace();
		}
		return message;
	}
}
